var _o60;
var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_ObjUtil = _o60 = /* */function (_cc$Component20) {
  function _ctor() {
    babel_classCallCheck(this, _ctor);
    return _callSuper(this, _ctor, arguments);
  }
  babel_inherits(_ctor, _cc$Component20);
  return babel_createClass(_ctor, null, [{
    key: "equalsObj",
    value: function equalsObj(e, t) {
      if (e === t) {
        return true;
      }
      if (_o60.isObject(e) && _o60.isObject(t) && Object.keys(e).length === Object.keys(t).length) {
        for (var _n23 in e) {
          if (e.hasOwnProperty(_n23) && !_o60.equalsObj(e[_n23], t[_n23])) {
            return false;
          }
        }
      } else {
        if (!_o60.isArray(e) || !_o60.isArray(e) || e.length !== t.length) {
          return false;
        }
        var _n24 = 0;
        for (var _i17 = e.length; _n24 < _i17; _n24++) {
          if (!_o60.equalsObj(e[_n24], t[_n24])) {
            return false;
          }
        }
      }
      return true;
    }
  }, {
    key: "NumberTOString",
    value: function NumberTOString(e, t) {
      var n = e.toString();
      for (; n.length < t;) {
        n = "0" + n;
      }
      return n;
    }
  }, {
    key: "randA2B",
    value: function randA2B(e, t) {
      return e + Math.random() * (t - e);
    }
  }, {
    key: "strlength",
    value: function strlength(e) {
      var t = 0;
      for (var _n25 = 0; _n25 < e.length; _n25++) {
        if (e.charCodeAt(_n25) > 127 || 94 == e.charCodeAt(_n25)) {
          t += 2;
        } else {
          t++;
        }
      }
      return t;
    }
  }, {
    key: "getgetCenterOfGravity",
    value: function getgetCenterOfGravity(e) {
      var t = 0;
      var n = 0;
      for (var _o70 = 0; _o70 < e.length; _o70++) {
        t += e[_o70].x;
        n += e[_o70].y;
      }
      t /= e.length;
      n /= e.length;
      return cc.v2(t, n);
    }
  }, {
    key: "isObject",
    value: function isObject(e) {
      return "[object Object]" === Object.prototype.toString.call(e);
    }
  }, {
    key: "isArray",
    value: function isArray(e) {
      return "[object Array]" === Object.prototype.toString.call(e);
    }
  }, {
    key: "isMap",
    value: function isMap(e) {
      return "[object Map]" === Object.prototype.toString.call(e);
    }
  }, {
    key: "isString",
    value: function isString(e) {
      return "[object String]" === Object.prototype.toString.call(e);
    }
  }, {
    key: "isNumber",
    value: function isNumber(e) {
      return "[object Number]" === Object.prototype.toString.call(e);
    }
  }, {
    key: "clonJson",
    value: function clonJson(e) {
      return JSON.parse(JSON.stringify(e));
    }
  }, {
    key: "replaceA2B",
    value: function replaceA2B(e, t, n) {
      for (var _o71 = 0; _o71 < e.length; _o71++) {
        if (this.isArray(e[_o71])) {
          this.replaceA2B(e[_o71], t, n);
        } else {
          e[_o71] == t && (e[_o71] = n);
        }
      }
      return e;
    }
  }, {
    key: "arr1toarr2",
    value: function arr1toarr2(e, t) {
      var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
      var _o63 = [];
      for (var _i18 = 0; _i18 < e.length; _i18++) {
        var _s7 = Math.floor(_i18 / t);
        _o63[_s7] || (_o63[_s7] = []);
        _o63[_s7].push(e[_i18] - n);
      }
      return _o63;
    }
  }, {
    key: "getPermutation",
    value: function getPermutation(e) {
      var t = [];
      for (var _n26 = 0; _n26 < e; _n26++) {
        var _e30 = 0;
        for (var _o72 = t.length; _e30 < _o72; _e30++) {
          t.push([].concat(babel_toConsumableArray(t[_e30]), [_n26]));
        }
        t.push([_n26]);
      }
      return t;
    }
  }, {
    key: "cloneMap",
    value: function cloneMap(e) {
      var t = Object.create(null);
      var _iterator3 = babel_createForOfIteratorHelper(e);
      var _step3;
      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var _step3$value = babel_slicedToArray(_step3.value, 2);
          var _o65 = _step3$value[0];
          var _i20 = _step3$value[1];
          t[_o65] = _i20;
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }
      t = JSON.stringify(t);
      t = JSON.parse(t);
      var n = new Map();
      var _i19 = 0;
      for (var _Object$keys2 = Object.keys(t); _i19 < _Object$keys2.length; _i19++) {
        var _o66 = _Object$keys2[_i19];
        n.set(_o66, t[_o66]);
      }
      return n;
    }
  }, {
    key: "Obj2Map",
    value: function Obj2Map(e) {
      if (_o60.isMap(e)) {
        return e;
      }
      var t = new Map();
      if ("{}" == e || "" == e) {
        return t;
      }
      _o60.isObject(e) || (e = JSON.parse(e));
      var _i21 = 0;
      for (var _Object$keys3 = Object.keys(e); _i21 < _Object$keys3.length; _i21++) {
        var _n27 = _Object$keys3[_i21];
        t.set(_n27, e[_n27]);
      }
      return t;
    }
  }, {
    key: "Map2Obj",
    value: function Map2Obj(e) {
      if (_o60.isObject(e)) {
        return e;
      }
      var t = new Object();
      if (_o60.isMap(e)) {
        var _iterator4 = babel_createForOfIteratorHelper(e.keys());
        var _step4;
        try {
          for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
            var _n28 = _step4.value;
            t[_n28] = e.get(_n28);
          }
        } catch (err) {
          _iterator4.e(err);
        } finally {
          _iterator4.f();
        }
      }
      return t;
    }
  }, {
    key: "Arr2Obj",
    value: function Arr2Obj(e) {
      if (_o60.isObject(e)) {
        return e;
      }
      var t = new Object();
      if (_o60.isArray(e)) {
        for (var _n29 = 0; _n29 < e.length; _n29++) {
          t[_n29] = e[_n29];
        }
      }
      return t;
    }
  }, {
    key: "rand",
    value: function rand() {
      this.seed = (9301 * this.seed + 49297) % 233280;
      return this.seed / 233280;
    }
  }, {
    key: "shuffle",
    value: function shuffle(e) {
      for (var _t30 = e.length - 1; _t30 >= 0; _t30--) {
        var _n30 = Math.floor(Math.random() * (_t30 + 1));
        var _o67 = e[_n30];
        e[_n30] = e[_t30];
        e[_t30] = _o67;
      }
      return e;
    }
  }, {
    key: "shuffleByseed",
    value: function shuffleByseed(e, t) {
      this.seed = t;
      for (var _n31 = e.length - 1; _n31 >= 0; _n31--) {
        var _t31 = Math.floor(this.rand() * (_n31 + 1));
        var _o68 = e[_t31];
        e[_t31] = e[_n31];
        e[_n31] = _o68;
      }
      return e;
    }
  }, {
    key: "shuffleString",
    value: function shuffleString(e) {
      var t = "";
      for (; e.length > 0;) {
        var _n32 = Math.random() * e.length | 0;
        t += e[_n32];
        e = e.replace(e[_n32], "");
      }
      return t;
    }
  }, {
    key: "permutation",
    value: function permutation(e, t, n, _o69, i, s) {
      if (t != n) {
        for (var _a18 = 0; _a18 < e.length; _a18++) {
          if (!_o69[_a18]) {
            _o69[_a18] = true;
            i.push(e[_a18]);
            this.permutation(e, t + 1, n, _o69, i, s);
            i.pop();
            _o69[_a18] = false;
          }
        }
      } else {
        s.push(babel_toConsumableArray(i));
      }
    }
  }]);
}(cc.Component);
def_ObjUtil.seed = 1;
def_ObjUtil = _o60 = cc__decorate([ccp_ccclass], def_ObjUtil);
exports.default = def_ObjUtil;